public class Main {
    public static void main(String[] args) {

        System.out.println("Hello and welcome!");
        Originator myOriginator = new Originator("奔驰",2,"13380234567");

        System.out.println(myOriginator.toString());
        //用备忘录保存状态
        Memento oldStateMemento = myOriginator.createMemento();
        //修改当前状态
        myOriginator.setCurrentName("宝马");
        myOriginator.setCurrentNo(1);
        myOriginator.setCurrentPhone("18024111876");

        System.out.println(myOriginator.toString());

        //恢复状态

        myOriginator.restoreStateByMemento(oldStateMemento);

        //打印恢复状态后的情况

        System.out.println(myOriginator.toString());
    }
}